var a = getApp(), t = !0;

Page({
    data: {
        activeName: 0,
        banner: [],
        recommend: [],
        category: []
    },
    onLoad: function(a) {
        this.getData();
    },
    onReady: function() {},
    tapUrl: function(a) {
        var t = a.currentTarget.dataset.url;
        if ("" == t) return !1;
        try {
            wx.navigateTo({
                url: t
            });
        } catch (a) {
            console.log(a);
        }
    },
    toGood: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + t
        });
    },
    toCate: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageB/member/category/search_v2/search_v2?id=" + t
        });
    },
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.yz-supply-camilo-resources.frontend.index.index");
        a._postNetWork({
            url: e,
            success: function(e) {
                var n = e.data;
                if (1 != n.result) return a.tips(n.msg);
                var o = {};
                o.banner = n.data.banner || [], o.recommend = n.data.recommend || [], o.category = [], 
                t.data.category.push({
                    id: 0,
                    name: "推荐分类",
                    children: n.data.category.recommand_category
                }), t.setData({
                    changeData: o,
                    category: t.data.category.concat(n.data.category.categorys)
                });
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    ondisplay: function(a) {
        if (t) {
            var e = a.detail.index, n = a.detail.display;
            "up" == a.detail.type && (n ? this.setData({
                activeName: e
            }) : this.setData({
                activeName: e + 1
            }));
        }
    },
    changeTabName: function(a) {
        console.log(a);
        var e = a.detail.index;
        e != this.data.activeName && (this.setData({
            activeName: a.detail.index
        }), wx.pageScrollTo({
            selector: ".category" + e,
            duration: 500
        }), t = !1, setTimeout(function() {
            t = !0;
        }, 500));
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});